<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>add</title>
	<style>
		.sheet_edit{
			margin:10px 20px;
			width: 98%;
			text-align: center;
		}
	</style>
</head>
<body>
	<form action="add.php" method="post">
		<table border="1" cellspacing="0" cellpadding="0" border-collapse="0" class="sheet_edit">
			<tr>
				<td colspan="4">编辑商品</td>
			</tr>
			<tr>
				<td>商品名称:</td>
				<td id="goodsName"><input type="text" name="name"></td>
				<td>是否热门</td>
				<td>
					<select name="is_hot" id="">
					<option value="不限">不限</option>
					<option value="是">是</option>
					<option value="否">否</option>
				</select>
				</td>
			</tr>
			<tr>
				<td>市场价格</td>
				<td><input type="text"></td>
				<td>商城价格</td>
				<td><input type="text"></td>
			</tr>
			<tr>
				<td>商品图片:</td>
				<td colspan="3"><input type="file" accept="image/jpg"></td>
			</tr>
			<tr>
				<td>所属分类</td>
				<td colspan="3">
					<select name="is_hot" id="">
					<option value="手机数码">不限</option>
				</select>
				</td>
			</tr>
			<tr>
				<td>商品描述</td>
				<td colspan="3"><textarea cols="60" rows="5"></textarea></td>
			</tr>
		</table>
		<input type="button" class="submit" value="提交">
	</form>
</body>
<script src="jquery.min.js"></script>
<script>
	$("#goodsName").blur(function(){
    		var value=$(this).val();
    		$.ajax({
    			url:"add.php",
    			type:'post',
                data:{name:value},
    			success:function(data){
    				if(data=='用户名已经被使用!') {
                        $('.tips p').text(data).fadeIn(1000).delay(2000).fadeOut(1000);
                        $(".name").val("").focus();
                    }
                    // else{
                     	
                    // }
    			}
    		})
    	})
</script>
</html>